<template>
  <div style="width: 90%;margin-left: 5%;margin-top: 10px">

    <el-form :model="nurse" label-width="120px">
      <el-form-item label="护士编号">
        <el-input v-model="nurse.nid" />
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="nurse.name" />
      </el-form-item>
      <el-form-item label="性别">
        <el-radio v-model="nurse.gender" label="男">男</el-radio>
        <el-radio v-model="nurse.gender" label="女">女</el-radio>
      </el-form-item>
      <el-form-item label="年龄">
        <el-input v-model="nurse.age" />
      </el-form-item>

        <el-form-item label="手机号">
            <el-input v-model="nurse.phone"></el-input>
          </el-form-item>

      <el-form-item label="角色">
        <el-select v-model="nurse.title" placeholder="请选择护士等级">
          <el-option label="初级护士" value="初级护士" />
          <el-option label="中级护师" value="中级护师" />
          <el-option label="高级护士长" value="高级护士长" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="save">新增用户</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
//去src/api路径下添加js文件
import { add } from '@/api/nurse'
export default {
  data(){
    return{
      nurse:{}
    }
  },
  methods:{
    save(){
      add(this.nurse).then(res=>{
        if(res.code==0){
          this.$alert('亲，新增护士成功了！', '新增成功', {
            confirmButtonText: '确定',
            callback: action => {
              this.$message({
                type: 'info',
                message: `action: ${ action }`
              });
              this.medication={}
            }
          });
        }
      })
    }
  }
}
</script>

<style>

</style>
